Skip to content

[Yiseull] WEEK 01 solutions#2665

Open
Yiseull wants to merge 7 commits into
DaleStudy:mainfrom
Yiseull:main
Open

[Yiseull] WEEK 01 solutions#2665
Yiseull wants to merge 7 commits into
DaleStudy:mainfrom
Yiseull:main

Conversation

@Yiseull

@Yiseull Yiseull commented Jun 26, 2026

Copy link
Copy Markdown

답안 제출 문제

작성자 체크 리스트

  • Projects의 오른쪽 버튼(▼)을 눌러 확장한 뒤, Week를 현재 주차로 설정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 StatusIn Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

검토자 체크 리스트

Important

본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!

  • 바로 이전에 올라온 PR에 본인을 코드 리뷰어로 추가해주세요.
  • 본인이 검토해야하는 PR의 답안 코드에 피드백을 주세요.
  • 토요일 전까지 PR을 병합할 수 있도록 승인해주세요.

@dalestudy

dalestudy Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

📊 Yiseull 님의 학습 현황

이번 주 제출 문제

문제 난이도 유형 분석
contains-duplicate Easy ✅ 의도한 유형
longest-consecutive-sequence Medium ✅ 의도한 유형
top-k-frequent-elements Medium ✅ 의도한 유형
two-sum Easy ✅ 의도한 유형

누적 학습 요약

  • 풀이한 문제: 0 / 75개
  • 이번 주 유형 일치율: 100% (4문제 중 4문제 일치)

문제 풀이 현황

카테고리 진행도 완료
Array □□□□□□□ 0 / 10 ← 아직 시작 안 함
Binary □□□□□□□ 0 / 5 ← 아직 시작 안 함
Dynamic Programming □□□□□□□ 0 / 11 ← 아직 시작 안 함
Graph □□□□□□□ 0 / 8 ← 아직 시작 안 함
Interval □□□□□□□ 0 / 5 ← 아직 시작 안 함
Linked List □□□□□□□ 0 / 6 ← 아직 시작 안 함
Matrix □□□□□□□ 0 / 4 ← 아직 시작 안 함
String □□□□□□□ 0 / 10 ← 아직 시작 안 함
Tree □□□□□□□ 0 / 14 ← 아직 시작 안 함
Heap □□□□□□□ 0 / 3 ← 아직 시작 안 함

🤖 이 댓글은 GitHub App을 통해 자동으로 작성되었습니다.

🔢 API 사용량 (gpt-5-nano)
요청 입력 토큰 출력 토큰 합계 비용
1 1,255 180 1,435 $0.000135
2 1,255 155 1,410 $0.000125
합계 2,510 335 2,845 $0.000260

@DaleSeo

DaleSeo commented Jun 27, 2026

Copy link
Copy Markdown
Member

@Yiseull 린트 오류 조치 부탁드립니다!

2026-06-27 at 10 12 11

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏷️ 알고리즘 패턴 분석

  • 패턴: Hash Map / Hash Set
  • 설명: 집합(set) 사용으로 중복 여부를 확인하는 방식으로, 해시를 이용한 빠른 중복 탐지가 핵심 패턴입니다.

📊 시간/공간 복잡도 분석

복잡도
Time O(n)
Space O(n)

피드백: 정수 배열의 중복 여부를 빠르게 확인하기 위해 모든 원소를 집합에 담아 크기 비교를 수행합니다.

개선 제안: 현재 구현이 적절해 보입니다.

💡 풀이에 시간/공간 복잡도를 주석으로 남겨보세요!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏷️ 알고리즘 패턴 분석

  • 패턴: Hash Map / Hash Set, Two Pointers
  • 설명: 집합을 이용해 연속 부분 수열의 시작점을 찾고, 각 시작점에서 연속 길이를 확장해 최장 길이를 구하는 방식으로 구현되어 있습니다. 해시 셋으로 중복 제거 및 O(n) 평균 시간 복잡도를 확보합니다.

📊 시간/공간 복잡도 분석

복잡도
Time O(n)
Space O(n)

피드백: 각 수에 대해 시작점 여부를 확인하고, 시작점인 경우에만 연속 길이를 확장합니다.

개선 제안: 현재 구현이 적절해 보입니다.

💡 풀이에 시간/공간 복잡도를 주석으로 남겨보세요!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏷️ 알고리즘 패턴 분석

  • 패턴: Hash Map / Hash Set, Heap / Priority Queue
  • 설명: 코드에서 각 숫자의 빈도수를 해시 맵에 저장하고, 빈도에 기반해 최대 k개를 뽑기 위해 힙(우선순위 큐)을 사용합니다. 이로써 두 가지 패턴이 모두 적용됩니다.

📊 시간/공간 복잡도 분석

복잡도
Time O(n log k)
Space O(n)

피드백: 해시맵으로 빈도수를 구하고 최소 힙을 이용해 k개를 유지하는 방식으로 동작합니다.

개선 제안: 현재 구현이 적절해 보입니다.

💡 풀이에 시간/공간 복잡도를 주석으로 남겨보세요!

Comment thread two-sum/Yiseull.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏷️ 알고리즘 패턴 분석

  • 패턴: Hash Map / Hash Set, Two Pointers
  • 설명: 주어진 코드는 한 번의 순회로 각 숫자의 필요 보수를 해시 맵에 저장하고, 필요한 값이 이미 맵에 있을 때를 찾아 두 인덱스를 반환한다. 즉 해시 맵을 이용한 탐색 기반 패턴과 두 수의 합 문제의 일반적 해결법을 적용한다.

📊 시간/공간 복잡도 분석

복잡도
Time O(n)
Space O(n)

피드백: 가치-인덱스 매핑을 이용해 목표 차이를 가진 숫자를 찾습니다.

개선 제안: 현재 구현이 적절해 보입니다.

💡 풀이에 시간/공간 복잡도를 주석으로 남겨보세요!

@parkhojeong parkhojeong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

가독성이 높아서 쉽게 잘 읽혔던 거 같습니다. 수고하셨습니다!

@@ -0,0 +1,3 @@
class Solution:
def containsDuplicate(self, nums: List[int]) -> bool:
return len(nums) != len(set(nums))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 직관적이어서 좋네요!

Comment on lines +7 to +14
# counter = {}
# for num in nums:
# if num in counter:
# counter[num] += 1
# continue
# counter[num] = 1
#
# return [key for key, counter in sorted(counter.items(), key=lambda x: -x[1])[0:k]]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

중복되는 주석이 들어간 거 같네요. 지워주셔도 좋을거 같습니다!

Comment on lines +6 to +14
if num - 1 in numsSet:
continue

size = 1
while num + 1 in numsSet:
size += 1
num += 1

answer = max(answer, size)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이해가 아주 잘되는 코드인 거 같습니다 👍

Comment on lines +18 to +21
if num in counter:
counter[num] += 1
continue
counter[num] = 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if num in counter:
counter[num] += 1
continue
counter[num] = 1
counter[num] = counter.get(num, 0) + 1

fallback 값을 사용해볼 수도 있을 거 같네요 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Solving

Development

Successfully merging this pull request may close these issues.

3 participants